/**
 * @name: ZhouGe
 * @msg: 清理缓存数据
 * @param {
 * key,
 * }
 * @return {null}
 */
let clear_data = function(key) {
  window.localStorage && window.localStorage.removeItem(key);
};

/**
 * @name: ZhouGe
 * @msg: 设置缓存数据
 * @param {
 * key,
 * value
 * }
 * @return {boolean}
 */
let set_data = function(key, value) {
  window.localStorage && window.localStorage.setItem(key, value);
  return true;
};

/**
 * @name:
 * @msg:
 * @param {
 * key,
 * }
 * @return {any}
 */
let get_data = function(key) {
  if (
    window.localStorage &&
    typeof window.localStorage.getItem(key) == "string" &&
    window.localStorage.getItem(key)
  ) {
    return window.localStorage.getItem(key);
  }
};
/**
 * @name: Pmy
 * @msg: 验证手机号格式是否正确
 * @param {*} phone
 * @return {*}
 */
let checkPhone = function(phone) {
  let reg = /^1[0-9]{10}$/;
  if (!reg.test(phone)) {
    return false;
  } else {
    return true;
  }
};






export {
  get_data,
  set_data,
  clear_data,
  checkPhone,
};
